<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<script src="/js/jquery.min.js?v=2.1.4"></script>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<input id="educationId" name="educationId" type="hidden">

							<div class="form-group">
								<label class="col-sm-3 control-label">人员姓名：</label>
								<div class="col-sm-8">
									<input type="hidden" id="userId" name="userId" th:value="${userInfoDTO.userId}" >
									<input id="username" disabled th:value="${userInfoDTO.username}"  name="username" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学历代码：</label>
								<div class="col-sm-8">
									<input id="educationCodeId" name="educationCodeId" type="hidden">
									<input id="eduCode" name="eduCode" class="form-control" type="text" style="cursor: pointer;" onclick="openDept()"
										   readonly="readonly" placeholder="选择学历代码">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学历名称：</label>
								<div class="col-sm-8">
									<input id="eduName" placeholder="选择学历代码" maxlength="10" name="eduName" class="form-control" type="text"
										   readonly="readonly">

								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学历年限（年）：</label>
								<div class="col-sm-8">
									<input id="eduYear" placeholder="选择学历代码" maxlength="10" name="eduYear" class="form-control" type="text"
										   readonly="readonly">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">教育类别：</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="eduCategory" value="1" />全日制
									</label>
									<label class="radio-inline">
										<input type="radio" name="eduCategory" value="0" />非全日制
									</label>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学位代码：</label>
								<div class="col-sm-8">
									<input id="degreeCode" placeholder="请输入长度不大于10的字符" maxlength="10" name="degreeCode" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学位名称：</label>
								<div class="col-sm-8">
									<input id="degreeName" placeholder="请输入长度不大于20的字符" maxlength="20" name="degreeName" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学校名称：</label>
								<div class="col-sm-8">
									<input id="schoolName" placeholder="请输入长度不大于26的字符" maxlength="26" name="schoolName" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">专业类别：</label>
								<div class="col-sm-8">
									<input id="subjectCategory" placeholder="请输入长度不大于10的字符" maxlength="10" name="subjectCategory" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">专业名称：</label>
								<div class="col-sm-8">
									<input id="subjectName" placeholder="请输入长度不大于16的字符" maxlength="16" name="subjectName" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">入学时间：</label>
								<div class="col-sm-8">
									<input id="entranceTime" placeholder="请选择入学时间" readonly name="entranceTime" class="layer-date form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">毕业时间：</label>
								<div class="col-sm-8">
									<input id="graduationTime" placeholder="请选择毕业时间" readonly name="graduationTime" class="layer-date form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学位授予时间：</label>
								<div class="col-sm-8">
									<input id="awardTime" placeholder="请选择学位授予时间" readonly name="awardTime" class="layer-date form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">毕业证书（图片）：</label>
								<div class="col-sm-8">
									<input type="hidden" id="graduationFileId" name="graduationFileId" >
									<img id="showImg" src="/img/backg01.jpg" style="width: 50%;cursor: pointer;" >
									<input  type="file" class="hidden" id="file" name="file" onchange="uploadFile(this.files)" />
								</div>

								<script type="text/javascript">
                                    $("#showImg").click(function () {
                                        $("#file").click();
                                    });

                                    function uploadFile(files) {
                                        var type = files[0].type;
                                        if(type.indexOf("image") < 0){
                                            layer.msg('请上传图片格式...', {
                                                icon: 2
                                            });
                                            return false;
                                        }
                                        var size = files[0].size;
                                        if ((size / 1024 / 1024) > 2) {
                                            layer.msg('图片大小不能超过2M...', {
                                                icon: 2
                                            });
                                            return false;
                                        }
                                        console.log("size=" + size);
                                        var formData = new FormData();
                                        formData.append("file", files[0]);
                                        $.ajax({
                                            data: formData,
                                            type: "POST",
                                            url: "/common/sysFile/upload",    // 图片上传出来的url，返回的是图片上传后的路径，http格式
                                            cache: false,
                                            contentType: false,
                                            processData: false,
                                            dataType: "json",
                                            success: function (data) {//data是返回的hash,key之类的值，key是定义的文件名
                                                $("#showImg").attr("src", data.fileName);
                                                $("#graduationFileId").val(data.sysFileId);
                                            },
                                            error: function () {
                                                layer.msg('上传失败', {
                                                    icon: 2
                                                });
                                            }
                                        });
                                    }
								</script>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">学位证书（图片）：</label>
								<div class="col-sm-8">
									<input type="hidden" id="awardFileId" name="awardFileId" >
									<img id="showImg1" src="/img/backg01.jpg" style="width: 50%;cursor: pointer;" >
									<input  type="file" class="hidden" id="file1" name="file1" onchange="uploadFile1(this.files)" />
								</div>

								<script type="text/javascript">
                                    $("#showImg1").click(function () {
                                        $("#file1").click();
                                    });

                                    function uploadFile1(files) {
                                        var type = files[0].type;
                                        if(type.indexOf("image") < 0){
                                            layer.msg('请上传图片格式...', {
                                                icon: 2
                                            });
                                            return false;
                                        }
                                        var size = files[0].size;
                                        if ((size / 1024 / 1024) > 2) {
                                            layer.msg('图片大小不能超过2M...', {
                                                icon: 2
                                            });
                                            return false;
                                        }
                                        console.log("size=" + size);
                                        var formData = new FormData();
                                        formData.append("file", files[0]);
                                        $.ajax({
                                            data: formData,
                                            type: "POST",
                                            url: "/common/sysFile/upload",    // 图片上传出来的url，返回的是图片上传后的路径，http格式
                                            cache: false,
                                            contentType: false,
                                            processData: false,
                                            dataType: "json",
                                            success: function (data) {//data是返回的hash,key之类的值，key是定义的文件名
                                                $("#showImg1").attr("src", data.fileName);
                                                $("#awardFileId").val(data.sysFileId);
                                            },
                                            error: function () {
                                                layer.msg('上传失败', {
                                                    icon: 2
                                                });
                                            }
                                        });
                                    }
								</script>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">状态：</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="status" value="1" />正常
									</label>
									<label class="radio-inline">
										<input type="radio" name="status" value="0" />禁用
									</label>
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
					<div class="ibox-content">
						<table id="exampleTable2" data-mobile-responsive="true">
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript" src="/js/appjs/phry/education/edit.js">
	</script>
	<script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#entranceTime',
                type: 'date',
                range: false,
                format: 'yyyy-M-d'
            });
        })
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#graduationTime',
                type: 'date',
                range: false,
                format: 'yyyy-M-d'
            });
        })
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#awardTime',
                type: 'date',
                range: false,
                format: 'yyyy-M-d'
            });
        })
	</script>
</body>
</html>
